//
//  MoBanThreeCell.m
//  MoBan
//
//  Created by apple on 16/7/11.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "MoBanThreeCell.h"
#import "ZBMoBanThree.h"
#import "ZBScrollView.h"
#import "ZBIteamCell.h"
#import "ZBThreeView.h"
#import "ZBMoBanThreeTbaleviewView.h"
@interface MoBanThreeCell()<ZBScrollViewDatasouce,ZBScrollViewDeleget,ZBMoBanThreeTbaleviewViewDataouce,ZBThreeViewDeleget,ZBMoBanThreeTbaleviewViewDeleget>
@property(nonatomic,strong)ZBScrollView *scrollview;
@property(nonatomic,strong)ZBThreeView *threeView;
@property(nonatomic,strong)ZBMoBanThreeTbaleviewView *threetableviewcellVIew;
@property(nonatomic,strong)NSMutableArray *array;
@end

@implementation MoBanThreeCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self AddUI:reuseIdentifier];
    }
    return self;
}

/**
 根据标识判断添加那个view
 */
-(void)AddUI:(NSString *)reuseIdentifier
{
    if ([reuseIdentifier isEqualToString:FirstCell]) {
        
        self.scrollview = [[ZBScrollView alloc]init];
        self.scrollview.datasouce = self;
        self.scrollview.deleget = self;
        [self.contentView addSubview:self.scrollview];
    }else if ([reuseIdentifier isEqualToString:SecondCell])
    {
        self.threeView = [[ZBThreeView alloc]init];
        self.threeView.deleget = self;
        [self.contentView addSubview:self.threeView];
    
    }else if ([reuseIdentifier isEqualToString:ThreeCell])
    {
        self.threetableviewcellVIew = [[ZBMoBanThreeTbaleviewView alloc]init];
        self.threetableviewcellVIew.datasouce =self;
        self.threetableviewcellVIew.deleget = self;
        [self.contentView addSubview:self.threetableviewcellVIew];
    }

}
-(void)layoutSubviews
{
    [super layoutSubviews];
    self.scrollview.frame = self.bounds;
    self.threeView.frame = self.bounds;
    self.threetableviewcellVIew.frame = self.bounds;
}
-(void)ZBdatasouce:(NSMutableArray *)array
{
    self.array = array;
    [self.scrollview reloadDta];
    [self.threetableviewcellVIew reloaddata];
}
/**
 第一个恒框的cell的模型
 
 */
-(NSMutableArray *)ZBAddIteamCellWithArray
{
    return self.array;
}
/**
 第二个返回的数组
 */
-(NSMutableArray *)ZBdatasouceIteams
{
    NSLog(@"%lu",(unsigned long)self.array.count);
    
    return self.array;
}
-(void)ZBIteamCell:(ZBIteamCell *)cell didSelected:(NSInteger)index
{
    
    if ([self.deleget respondsToSelector:@selector(ZBdidSelected:)]) {
        [self.deleget ZBdidSelected:index];
    }

}
-(void)ZBCellClic
{

}
-(void)ZBCellClicIndex:(NSInteger)index
{

    if ([self.deleget respondsToSelector:@selector(ZBThreecellSelect:)]) {
        [self.deleget ZBThreecellSelect:index];
    }
}

@end
